﻿
/*----------------------------------------------------------------//
// 文件名：MoNotice.cs
// 文件功能描述：实体 MoNotice.
// 
// 创建标识：Template  ver 5.0.20090429 2009-11-20
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoNotice
using System;
using System.Data;
namespace EQT.Model
{
    /// <summary>
    /// 业务实体MoNotice
    /// </summary>
    public partial class MoNotice : ICloneable
    {
        #region 表Notice的字段
        private string noticeId;
        private string uid;
        private int publishType;
        private string noticeContent;
        private DateTime createTime;
        private string title;
        #endregion

        #region 构造函数
        public MoNotice()
        {
            createTime = new DateTime(1900, 1, 1);

        }
        #endregion

        #region 拷贝构造函数

        public MoNotice(MoNotice item)
        {
            item.CopyTo(this);
        }
        #endregion

        #region 带参数构造函数
        public MoNotice(string noticeId, string uid, int publishType, string noticeContent, DateTime createTime, string title)
        {
            this.noticeId = noticeId;
            this.uid = uid;
            this.publishType = publishType;
            this.noticeContent = noticeContent;
            this.createTime = createTime;
            this.title = title;
        }
        #endregion

        #region 表Notice的字段属性
        /// <summary>
        ///使用GUID实现；
        /// </summary>
        public string NoticeId
        {
            get { return noticeId; }
            set { noticeId = value; }
        }
        /// <summary>
        /// UID
        /// </summary>
        public string Uid
        {
            get { return uid; }
            set { uid = value; }
        }
        /// <summary>
        ///内别只有2种：公告，定向消息
        /// </summary>
        public int PublishType
        {
            get { return publishType; }
            set { publishType = value; }
        }
        /// <summary>
        /// NOTICE_CONTENT
        /// </summary>
        public string NoticeContent
        {
            get { return noticeContent; }
            set { noticeContent = value; }
        }
        /// <summary>
        /// CREATE_TIME
        /// </summary>
        public DateTime CreateTime
        {
            get { return createTime; }
            set { createTime = value; }
        }
        /// <summary>
        /// TITLE
        /// </summary>
        public string Title
        {
            get { return title; }
            set { title = value; }
        }
        #endregion

        #region 辅助函数
        /// <summary>
        /// 拷贝函数
        /// </summary>
        public MoNotice CopyTo(MoNotice item)
        {
            item.noticeId = this.noticeId;
            item.uid = this.uid;
            item.publishType = this.publishType;
            item.noticeContent = this.noticeContent;
            item.createTime = this.createTime;
            item.title = this.title;
            return item;
        }
        /// <summary>
        /// 克隆函数
        /// </summary>		
        public object Clone()
        {
            MoNotice mo = new MoNotice();
            mo.NoticeId = this.NoticeId;
            mo.Uid = this.Uid;
            mo.PublishType = this.PublishType;
            mo.NoticeContent = this.NoticeContent;
            mo.CreateTime = this.CreateTime;
            mo.Title = this.Title;
            return mo;
        }
        ///<summary>
        ///判断对象是否相等
        ///<summary>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }
            else
            {
                MoNotice NewNotice = obj as MoNotice;
                if (NewNotice == null)
                {
                    return false;
                }
                else
                {
                    if (NewNotice.NoticeId == this.NoticeId && NewNotice.Uid == this.Uid && NewNotice.PublishType == this.PublishType && NewNotice.NoticeContent == this.NoticeContent && NewNotice.CreateTime == this.CreateTime && NewNotice.Title == this.Title)
                    {
                        return true;
                    }
                }

            }
            return false;

        }
        ///TODO:you should modify GetHashCode by yourself.
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return String.Format(System.Globalization.CultureInfo.InvariantCulture, "NoticeId={0}/Uid={1}/PublishType={2}/NoticeContent={3}/CreateTime={4}/Title={5}", noticeId, uid, publishType, noticeContent, createTime, title);

        }
        #endregion


        #region DataTable Help Function
        ///<summary>
        ///DataRow转换成Model
        ///</summary>
        public void Row2Model(DataRow row)
        {
            if (row["Notice_ID"] != null && row["Notice_ID"] != DBNull.Value)
            {
                this.NoticeId = (string)row["Notice_ID"];
            }
            else
            {
                this.NoticeId = string.Empty;
            }
            if (row["UID"] != null && row["UID"] != DBNull.Value)
            {
                this.Uid = (string)row["UID"];
            }
            else
            {
                this.Uid = string.Empty;
            }
            if (row["Publish_Type"] != null && row["Publish_Type"] != DBNull.Value)
            {
                this.PublishType = (int)row["Publish_Type"];
            }
            else
            {
                this.PublishType = 0;
            }
            if (row["Notice_Content"] != null && row["Notice_Content"] != DBNull.Value)
            {
                this.NoticeContent = (string)row["Notice_Content"];
            }
            else
            {
                this.NoticeContent = string.Empty;
            }
            if (row["Create_Time"] != null && row["Create_Time"] != DBNull.Value)
            {
                this.CreateTime = (DateTime)row["Create_Time"];
            }
            else
            {
                this.CreateTime = DateTime.MinValue;
            }
            if (row["Title"] != null && row["Title"] != DBNull.Value)
            {
                this.Title = (string)row["Title"];
            }
            else
            {
                this.Title = string.Empty;
            }
        }

        ///<summary>
        ///Model转换成DataRow
        ///</summary>
        public void Model2Row(DataRow row)
        {
            row["Notice_ID"] = this.NoticeId;
            row["UID"] = this.Uid;
            row["Publish_Type"] = this.PublishType;
            row["Notice_Content"] = this.NoticeContent;
            row["Create_Time"] = this.CreateTime;
            row["Title"] = this.Title;
        }
        #endregion
    }
}
#endregion
